<template>
  <div>
    <!-- 下拉菜单
     组件名：el-dropdown
                  默认插槽：默认展示 的文本内容
                  具名插槽：dropdown:菜单内容
                    el-dropdown-menu
                       el-dropdown-item
     点击事件处理
        el-dropdown-item  command="标识"
        el-dropdown  @command="(command)=>  点击项的command标识"
    -->
    <el-dropdown @command="commandEvent">
      <span>列表</span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item command="home">首页</el-dropdown-item>
          <el-dropdown-item command="other">项目地址</el-dropdown-item>
          <el-dropdown-item divided command="exit">登出</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>
<script>
export default {
  methods: {
    commandEvent(command) {
      switch (command) {
        case 'home':
          this.$message.success('首页')
          break
        case 'other':
          location.href = 'https://gitee.com/dhf481229/hr87.git'
          break
        case 'exit':
          this.$message.success('退出')
          break
      }
    }
  }
}
</script>
<style></style>
